First Order Equations: Euler's Numerical Method

Edmund Chiang
MATH2351 / 2352 — Boyce & DiPrima §2.7
February 7, 2026

1   Euler's Method

Euler's method is a simple but effective method to give approximation to solutions of IVPs of the type

$$\frac{dy}{dt} = f(t, y), \quad y(t_0) = y_0. \tag{1}$$

1.1   The Main Idea

The main idea in Euler's method is essentially a first order (i.e., tangent line) approximation to an unknown solution of the IVP. Let $\phi(t)$ be a solution to (1). So we have $\phi(t_0) = y_0$. Thus

$$\left.\frac{dy}{dt}\right|_{t_0} = f(t_0, y_0)$$

is the gradient of $y$ at the point $(t_0, y_0)$. We can write down the tangent line equation to the $y$ at this point $(t_0, y_0)$:

$$y = y_0 + f(t_0, y_0)(t - t_0)$$

Suppose we now choose $t_1 > t_0$ and $t_1$ is close to $t_0$. Then the value

$$y_1 = y_0 + f(t_0, y_0)(t_1 - t_0)$$

gives an approximation to $\phi(t_1)$.

Geometric Interpretation

At $(t_0, y_0)$, we draw the tangent line with slope $f(t_0, y_0)$. Moving along this tangent line to $t = t_1$ gives us the approximate value $y_1$. The closer $t_1$ is to $t_0$, the better the approximation.


1.2   Iterative Process

We take $t = t_1$ as our focus. Thus

$$\left.\frac{dy}{dt}\right|_{t_1} = f(t_1, y_1)$$

is the gradient of $y$ at the point $(t_1, y_1)$ which gives an approximation to the real gradient

$$\left.\frac{dy}{dt}\right|_{t_1} = f(t_1, \phi(t_1)).$$

The tangent line equation is given by

$$y = y_1 + f(t_1, y_1)(t - t_1)$$

at $(t_1, y_1)$. We now choose $t_2 > t_1$ but close to $t_1$ as in the last step so that

$$y_2 = y_1 + f(t_1, y_1)(t_2 - t_1)$$

and

$$\left.\frac{dy}{dt}\right|_{t_2} = f(t_2, y_2)$$

is an approximation to

$$\left.\frac{dy}{dt}\right|_{t_2} = f(t_2, \phi(t_2)).$$

We now obtain a tangent line equation

$$y = y_2 + f(t_2, y_2)(t - t_2)$$

at $(t_2, y_2)$.

We can continue the above process repeatedly to obtain a sequence $t_1, t_2, t_3, \ldots$ and approximate values $y_1, y_2, y_3, \cdots$ to arrive at:


1.3   The Algorithm

Theorem — Euler's Method Algorithm

The following algorithm

$$\boxed{y_{n+1} = y_n + f(t_n, y_n)(t_{n+1} - t_n) = y_n + f_n \cdot (t_{n+1} - t_n)}, \quad n = 0, 1, 2, 3, \cdots$$

where $f_n = f(t_n, y_n)$, would give approximations to the IVP

$$\frac{dy}{dt} = f(t, y), \quad y(t_0) = y_0.$$

The union of the polygonal segments through the points

$$(t_0, y_0), \quad (t_1, y_1), \quad (t_2, y_2), \quad \cdots$$

gives an approximation to the real solution $y = \phi(t)$.

Definition — Step Size

In practical implementation, we write $h = t_{n+1} - t_n$ as a fixed quantity for all $n \geq 1$. So,

$$y_{n+1} = y_n + f_n \cdot h, \quad n = 0, 1, 2, \cdots$$

The constant $h$ is called the step size.

2   Worked Example

2.1   Problem Setup

Example

Use Euler's method to solve numerically the IVP:

$$\frac{dy}{dt} = 3 + e^{-t} - \frac{1}{2}y, \quad y(0) = 1.$$

So we identify $t_0 = 0$ and $y_0 = 1$. Let us choose the step size $h = 0.1$ and $t_0 = 0$.

Here, $f(t, y) = 3 + e^{-t} - \frac{y}{2}$.


2.2   Step-by-Step Calculation

Step 1: Find $y_1$

According to Euler's method, we have

\begin{align} y_1 &= y_0 + f(t_0, y_0) \cdot h \\[6pt] &= 1 + \left(3 + e^0 - \frac{1}{2}\right)(0.1) \\[6pt] &= 1 + (3.5)(0.1) = 1.35. \end{align}

So the first approximation is $(t_1, y_1) = (0.1, 1.35)$.

Step 2: Find $y_2$

Now

\begin{align} y_2 &= y_1 + f(t_1, y_1) \cdot h \\[6pt] &= 1.35 + \left(3 + e^{-0.1} - \frac{1.35}{2}\right)(0.1) \\[6pt] &= 1.35 + (3.2298)(0.1) = 1.672. \end{align}

We have therefore obtained our second approximation: $(t_2, y_2) = (0.2, 1.672)$.

Step 3: Find $y_3$

Similarly,

\begin{align} y_3 &= y_2 + f(t_2, y_2) \cdot h \\[6pt] &= 1.672 + \left(3 + e^{-0.2} - \frac{1.672}{2}\right)(0.1) \\[6pt] &= 1.971. \end{align}

Thus, $(t_3, y_3) = (0.3, 1.971)$, similarly $(t_4, y_4) = (0.4, 2.246), \cdots$.

Summary Table

$t$ Euler's approximation
0.01.0000
0.11.3500
0.21.6730
0.31.9712
0.42.2467

2.3   Comparison with Exact Solution

This DE can be solved explicitly, for example, by integrating factor method:

$$y(t) = 6 - 2e^{-t} - 3e^{-t/2}$$

A comparison of the approximate values obtained from Euler's method and that from the exact solution, we have, with step size $h = 0.1$:

$t$ $\phi(t)$ (exact) Euler's approx. Error
0.01.00001.00000.0000
0.11.33661.35000.0134
0.21.64801.67300.0250
0.31.93621.97120.0350
0.42.20322.24670.0435
Observation

Notice that the error accumulates as we take more steps. At $t = 0.4$, the error is about 2% of the actual value. The error grows because each approximation is based on the previous (already approximate) value.

3   Effect of Step Size

We record here several comparisons with decreasing step sizes:

Step size $h = 0.1$

step$t$$y$global error
00.1.0.
10.11.35−0.0133631
20.21.67298−0.0249575
30.31.97121−0.034968
40.42.24673−0.0435614
50.52.50142−0.0508883

Step size $h = 0.025$ (smaller step, more accuracy)

step$t$$y$global error
00.1.0.
40.11.33988−0.00324277
80.21.65409−0.00605954
120.31.94473−0.00849458
160.42.21376−0.0105878
200.52.46291−0.0123754
Key Insight — Step Size and Accuracy

Decreasing the step size from $h = 0.1$ to $h = 0.025$ reduces the global error at $t = 0.5$ from about $0.051$ to about $0.012$ — roughly a 4-fold improvement (since $0.1/0.025 = 4$).

In general, halving the step size approximately halves the error for Euler's method. This is because Euler's method has first-order accuracy.

Remark

Please ignore the "local error" column in numerical outputs. The "global error" column represents the error with the Euler approximation against the real solution (not always given by exact solutions).

4   Exercises

Exercises (Boyce & DiPrima)
  1. Find approximate values of the solution of the initial value problem

    $$y' = 3 + t - y, \quad y(0) = 0$$

    at $t = 0.1, 0.2, 0.3,$ and $0.4$ using the Euler method with $h = 0.1$.

    (Ans. 1.2, 1.39, 1.571, 1.7439)
  2. Find approximate values of the solution of the initial value problem of

    $$y' = \frac{3t^2}{3y^2 - 4}, \quad y(1) = 0$$

    at $t = 1.2, 1.4, 1.6,$ and $1.8$ using the Euler method with $h = 0.1$.

    (Ans. −0.166134, −0.410872, 0.804660, 4.15867)

5   Practice MCQ

Practice 1: Understanding Euler's Method

Consider the IVP: $\;\dfrac{dy}{dt} = f(t, y), \quad y(t_0) = y_0$

PHASE 0 Understand the Method

What is the geometric idea behind Euler's method?

Good! Now let's understand the formula...
PHASE A The Formula

In Euler's formula $y_{n+1} = y_n + f_n \cdot h$, what does $f_n$ represent?

What does $h$ represent, and how does it affect accuracy?

Formula understood! Now let's apply it...
PHASE B Quick Application Check
Step B1

Given $y_0 = 1$, $f(t_0, y_0) = 3.5$, and $h = 0.1$, what is $y_1$?

Step B2

If the exact solution at $t_1 = 0.1$ is $\phi(0.1) = 1.3366$, what is the error of Euler's approximation $y_1 = 1.35$?

Excellent! You understand Euler's method conceptually.
Practice 2: Euler's Method Calculation (Exercise 1)

Solve using Euler's method with $h = 0.1$:

$$y' = 3 + t - y, \quad y(0) = 0$$

Find $y$ at $t = 0.1, 0.2, 0.3, 0.4$.

PHASE 0 Identify Components

What is $f(t, y)$ for this problem?

Setup complete! Let's calculate step by step...
PHASE A Build Calculation Strategy

What is $f_0 = f(t_0, y_0) = f(0, 0)$?

Calculate $y_1 = y_0 + f_0 \cdot h$:

Good! Continue with the remaining steps...
PHASE B Complete Calculation
Step B1: Find $y_2$

At $(t_1, y_1) = (0.1, 0.3)$: $f_1 = 3 + 0.1 - 0.3 = 2.8$. What is $y_2$?

Step B2: Find $y_3$

At $(t_2, y_2) = (0.2, 0.58)$: $f_2 = 3 + 0.2 - 0.58 = 2.62$. What is $y_3$?

Step B3: Find $y_4$

At $(t_3, y_3) = (0.3, 0.842)$: $f_3 = 3 + 0.3 - 0.842 = 2.458$. What is $y_4$?

Note: The textbook answer gives $y(0.4) \approx 1.7439$. This problem may have a typo or the answer key refers to different values. The method demonstrated here is correct.

Summary: $(0.1, 0.3), (0.2, 0.58), (0.3, 0.842), (0.4, 1.088)$

Practice 3: Challenging Euler Calculation (Exercise 2)

Solve using Euler's method with $h = 0.1$:

$$y' = \frac{3t^2}{3y^2 - 4}, \quad y(1) = 0$$

Find $y$ at $t = 1.1$ and $t = 1.2$.

PHASE 0 Analyze the Problem

What potential issue exists with this DE at the initial condition $y(1) = 0$?

Good analysis! Let's proceed with the calculation...
PHASE A Calculate First Steps

Calculate $f_0 = f(1, 0) = \dfrac{3(1)^2}{3(0)^2 - 4}$:

Calculate $y_1 = y_0 + f_0 \cdot h = 0 + (-0.75)(0.1)$:

Good! Now continue to find $y_2$...
PHASE B Find $y_2$
Step B1: Calculate $f_1$

At $(t_1, y_1) = (1.1, -0.075)$, calculate $f_1 = \dfrac{3(1.1)^2}{3(-0.075)^2 - 4}$:

Hint: $3(1.1)^2 = 3.63$ and $3(0.075)^2 = 0.016875$

Step B2: Calculate $y_2$

$y_2 = y_1 + f_1 \cdot h = -0.075 + (-0.911)(0.1) = ?$

Excellent! Your answer $y(1.2) \approx -0.166$ matches the textbook answer of $-0.166134$.

Note: This problem has a singularity when $3y^2 = 4$, i.e., $y = \pm\sqrt{4/3} \approx \pm 1.155$. As the solution evolves, be aware of this potential issue.

Practice 4: Understanding Euler's Method Error

Consider Euler's method applied to any IVP with step size $h$.

Question 1

If halving the step size (from $h$ to $h/2$) roughly halves the error, what is Euler's method called?

Question 2

Why does the global error in Euler's method tend to grow as $t$ increases?

Question 3

If step size $h = 0.1$ gives error $\approx 0.05$ at some $t$, what error would you expect with $h = 0.025$?

Well done! You understand the error behavior of Euler's method.

— End of Euler's Numerical Method Notes —